package com.framework.service.impl;

import cn.dev33.satoken.util.SaResult;
import com.framework.minio.MinioUtil;
import com.framework.service.MinioService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import javax.transaction.Transactional;

/**
 * @Description: 普通文件上传接口实现（数据直接存储minio）
 * @Author: JamesYao
 * @DateTime: 2024/2/23 22:12
 */
@Service
@RequiredArgsConstructor
@Transactional
public class MinioServiceImpl implements MinioService {

    private final MinioUtil minioUtil;

    @Override
    public SaResult uploadFile(MultipartFile file) {
        String aPath = minioUtil.uploadReturnUrl(file, "comment");
        return SaResult.data(aPath);
    }
}
